#ifndef _H_NET_H_
#define _H_NET_H_


#include <stdlib.h>
#include <sys/socket.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "base_define.h"
#include "msocket.h"
#include "epoll_event.h"
#include "lua.h"

#define MAXLINE 10
#define OPEN_MAX 100
#define LISTENQ 200
#define SERV_PORT 8883
#define INFTIM 1000

#ifndef __ENTER_FUNCTION
#define __ENTER_FUNCTION	fprintf(stdout,"%s,%s,%d\n",__FILE__,__func__,__LINE__);
#endif

#ifndef __LEAVE_FUNCTION
#define __LEAVE_FUNCTION
#endif


typedef struct t_net_s {
	socketer *server_socket; 	
	epollmgr *m_epollmgr;
	char local_addr[50];
	int port;
	int init;	
} t_net;
int net_open(lua_State *L);
void *setup_net(lua_State *L);

int meth_start_server_listen(lua_State *L);
int meth_check_connect(lua_State *L);
int meth_check_func(lua_State *L);


#endif
